package net.helix.ui;


import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import net.infonode.docking.RootWindow;
import net.infonode.docking.properties.RootWindowProperties;
import net.infonode.docking.theme.DockingWindowsTheme;
import net.infonode.docking.theme.ShapedGradientDockingTheme;
import net.infonode.docking.util.DockingUtil;
import net.infonode.docking.util.PropertiesUtil;
import net.infonode.docking.util.ViewMap;
import net.infonode.util.Direction;

public class UIHomeScreen {
	
	private RootWindowProperties rootProperties = new RootWindowProperties();
	private DockingWindowsTheme currentTheme = new ShapedGradientDockingTheme();
	
	private RootWindowProperties titleBarStyleProperties;
	
	/**
	 * Create the welcome screen that should include the most recent projects, templates, tutorials, and other fun stuff...
	 */
	public UIHomeScreen(){
		
		ViewMap viewMap = new ViewMap();
		
		// Create the rootWindow (one per tab on the mainTabbedPane)
		RootWindow rootWindow = DockingUtil.createRootWindow(viewMap, true);
		
		rootProperties.addSuperObject(currentTheme.getRootWindowProperties());
		rootWindow.getRootWindowProperties().addSuperObject(rootProperties);
		
		rootProperties.getDockingWindowProperties().setCloseEnabled(false);
		titleBarStyleProperties = PropertiesUtil.createTitleBarStyleRootWindowProperties();
		rootProperties.addSuperObject(titleBarStyleProperties);
		
		rootProperties.getTabWindowProperties().getTabbedPanelProperties().setTabAreaOrientation(Direction.UP);
		
		UIEngineTop.AddTabPane("Welcome Screen", rootWindow);
		
		// Frame showing layout for myMainRootWindow. 
		// Don't forget to remove this line when release compiling
		// DeveloperUtil.createWindowLayoutFrame("My Main RootWindow", rootWindow).setVisible(true);
		
		rootWindow.addComponentListener(new ComponentAdapter(){
			@Override
			public void componentHidden(ComponentEvent arg0) {
				// any animations made can be paused here...
			}
			@Override
			public void componentShown(ComponentEvent arg0) {
				UIEngineTop.setMenu(UIEngineTop.getDefaultMenu());
			}
			
		});
		
	}
}
